package com.tjw.ec.upms.api.feign.factory;

import com.tjw.ec.upms.api.feign.RemotePositionService;
import com.tjw.ec.upms.api.feign.fallback.RemotePositionServiceFallbackImpl;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;


/**
 * 远程调用异常工厂 : 职位表,有上级与下级之分;
 *
 * @author T-junwen
 * @email t-junwen@foxmail.com
 * @date 2019-08-02 11:58:44
 */
@Slf4j
@Component
public class RemotePositionServiceFallbackFactory implements FallbackFactory<RemotePositionService> {

    @Override
    public RemotePositionService create(Throwable throwable) {
        RemotePositionServiceFallbackImpl remotePositionServiceFallback = new RemotePositionServiceFallbackImpl();
        remotePositionServiceFallback.setCause(throwable);
        return remotePositionServiceFallback;
    }
}

